package com.java.actual.huarongdao;

import java.awt.Color;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;

import javax.swing.JButton;

public class Person extends JButton {
	private int number;
	private Color c;
	public Person(int number,String name){
		super(name);
		this.number=number;
		c=new Color(255,245,170);
		
		initial();
	}
	public void initial(){
		setBackground(c);
		//随时将按钮颜色变化显示出来
		this.c=getBackground();
		addEventHandler();
	}
	public void addEventHandler(){
		addFocusListener(new FocusAdapter(){

			public void focusGained(FocusEvent e) {
				Person.this.setBackground(Color.GRAY);
			}

			public void focusLost(FocusEvent e) {
				setBackground(c);
			}
			
		});
	}
}
